class GroupsController < ApplicationController
layout "m"
  def index
      @activeactions = ActionItem.find(:all, :conditions=>["status!=0"])
      @activeactions.delete_if{|x| x.project.status == 0}
      @activeprojects = Project.find(:all,:conditions=>["status!=0"])
      @closedprojects = Project.find(:all,:conditions=>["status=0"])
      @users = User.find(:all,:conditions=>["status!=0"])
      @activecontacts = Contact.find(:all,:conditions=>["status!=0"])
  end
  def news
    if params[:viewoptions]
      current_user.pref1 = params[:viewoptions][:length]
      current_user.save!
    end
    @news = ProjectEntry.find(:all,:limit=>40,:order=>"created_at DESC") 
    @news += ActionItemEntry.find(:all,:limit=>40,:order=>"created_at DESC") 
    @news += ContactEntry.find(:all,:limit=>40,:order=>"created_at DESC")
    @news += Announcement.find(:all,:limit=>40,:order=>"created_at DESC")
    @news += FundEntry.find(:all,:limit=>40,:order=>"created_at DESC")
    @news += LineItemEntry.find(:all,:limit=>40,:order=>"created_at DESC")
    @news = @news.sort_by{|x| [x[:created_at]]}.reverse
    @news = @news[0,current_user.pref1.to_i]
      render :partial => "news", :locals => { :@news => @news }
  end
end
